/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

function createXMLHttpRequest(){
    var xmlHttp;
    if (window.ActiveXObject) {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
      }
    else if (window.XMLHttpRequest) {
        xmlHttp = new XMLHttpRequest();
    }
    return xmlHttp;
}

function enviarCriterio(li,iduldestino){
    var i = iduldestino;
    var operacion;
    var criterio;

    if(i=="ul1"){
      criterio="ciudad";
      operacion = "removerCriterio";
    }else if(i=="ul2"){
       criterio="marca";
       operacion = "removerCriterio";
    }else if(i=="ul3"){
       criterio="delito";
       operacion = "removerCriterio";
    }else if(i=="ul4"){
        criterio="ciudad";
        operacion = "agregarCriterio";
    }else if(i=="ul5"){
        criterio="marca";
        operacion = "agregarCriterio";
    }else if(i=="ul6"){
        criterio="delito";
        operacion = "agregarCriterio";
    }

    var valor = li.value;

    var req = createXMLHttpRequest();

    var url = "ConsultaDenuncias?operacion="+operacion+"&criterio="+criterio+"&valor="+valor;

    req.open("GET",url, true);
    req.onreadystatechange = function(){
        if(req.readyState == 4){
            if(req.status == 200){

            }else{
                alert("Error en requerimiento ajax. req.status: "+req.status);
            }
        }
    };
    req.send(null);
}

